﻿using UnityEngine;

public class Enemy : MonoBehaviour
{
    protected Animator anim;
    protected AudioSource deathAudio;//变量重命名快捷键：F2
    protected virtual void Start()
    {
        anim = GetComponent<Animator>();
        deathAudio = GetComponent<AudioSource>();
    }

    public void JumpOn()
    {
        GetComponent<Collider2D>().enabled = false;
        GetComponent<Rigidbody2D>().gravityScale = 0;
        anim.SetTrigger("death");
        deathAudio.Play();
    }
    public void Death()
    {

        Destroy(gameObject);
    }

}
